cap confirm file "$data_out/APFT.dta" 
if _rc!=0 { 
do "$Outcomes/APFT.do"
}
else use "$data_out/APFT.dta", clear 

label var ed_prescription "Prescription in ED"
label var apft_annual "Probability of Taking a Fitness Test within 1 Year"
label var pass "Probability of Passing a Fitness Test within 1 Year"
label var z_score "Fitness Test Z-Score Conditional on Taking a Test"



foreach outcome in  apft_annual pass z_score {
eststo `outcome'_C:	ivreghdfe `outcome' $spec1
estadd ysumm, replace

eststo `outcome'_Q:	ivreghdfe `outcome' $spec2
estadd ysumm, replace
}

#delimit ;

	//word
esttab apft_annual_C pass_C z_score_C using "APFT.rtf" , 
	replace label se star(* 0.10 ** 0.05 *** 0.01)
	b(4) se(4)
	stats(ymean N ,
	fmt(a2 %-9.0fc)
	label("Sample Mean" "Observations"))
		keep(ed_prescription)
		title(IV Results for Fitness Tests - Prescribing Rate Instrument);
		
	
esttab apft_annual_Q pass_Q z_score_Q using "APFT.rtf" ,  
	append label se star(* 0.10 ** 0.05 *** 0.01)
	b(4) se(4)
	stats(ymean N ,
	fmt(a2 %-9.0fc)
	label("Sample Mean" "Observations"))
		keep(ed_prescription)
		title(IV Results for Fitness Tests - 4th vs 1st Quartile Instrument);
		
 
#delimit cr


